﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleText
{
    [Serializable]
    public class StatisticsClass
    {
        public Dictionary<String, Int64> Data = new Dictionary<String, Int64>();

        public void Clear()
        {
            Data.Clear();
        }

        public Int64 Total
        {
            get
            {
                Int64 total = 0;
                foreach (Int64 value in Data.Values)
                    total += value;
                return total;
            }
        }

        public Int64 At(String key)
        {
            if (Data.ContainsKey(key))
                return Data[key];
            else
                return 0;
        }

        public void Add(String key, Int64 value)
        {
            Data[key] = At(key) + value;
        }
    }
}
